import 'package:bwt_ad_flutter/BwtAdCore.dart';
import 'package:bwt_ad_flutter/ad/BwtAd.dart';
import 'package:bwt_ad_flutter/ad/loader/BwtAdLoader.dart';

import '../../manager/BwtAdManager.dart';

class BwtInterstitialAdLoader extends BwtAdLoader<BwtAd> {
  /// 加载广告
  loadAd({required String posId, bool loadThenShow = true}) {
    load(
      posId: posId,
      methodName: loadThenShow
          ? BwtAdCore.methodLoadThenShowInterstitialAd
          : BwtAdCore.methodLoadInterstitialAd,
    );
  }

  /// 展示插屏广告
  showAd({required BwtAd bwtAd}) async {
    await BwtAdManager.invokeMethod(
      method: BwtAdCore.methodShowInterstitialAd,
      params: {BwtAdCore.keyAdId: bwtAd.adId},
    );
  }

  @override
  BwtAd createBwtAd({
    required String adId,
    required Map<String, dynamic>? arguments,
  }) {
    return BwtAd(adId: adId, adLoaderId: adLoaderId);
  }
}
